var express = require('express');
var router = express.Router();

const {
    addApply,
    getApply,
    getApplyByShopid,
    updateApplyById,
    deleteApplysById,
    updateApplyStatus
} = require("../server/applyService");

// type: Number, // 申请类型（⻔门店管理理员申请1 /新⻔门店申请2 /注销⻔门店申请3）
// status: Number, // 申请状态（申请中1 /已通过2 /未通过3）
router.post('/addApply', async (req, res) => {
    res.send(await addApply(req.body));
});

//获取申请类型状态集合，包含申请的门店，门店管理员
router.get('/getApply', async (req, res) => {
    res.send(await getApply(req.query));
});

//驳回修改状态为status:3； 同意修改状态为status:2
router.post('/updateApplyById', async (req, res) => {
    res.send(await updateApplyById(req.body));
});

router.get('/getApplyByShopid', async (req, res) => {
    res.send(await getApplyByShopid(req.query));
});

router.post('/deleteApplysById', async (req, res) => {
    res.send(await deleteApplysById(req.body));
});

//修改申请状态值
router.post('/updateApplyStatus', async (req, res) => {
    res.send(await updateApplyStatus(req.body));
});


module.exports = router;